package com.bite.friend.controller.question;


import com.bit.common.security.aspect.NotRequireLogin;
import com.bite.common.core.controller.BaseController;
import com.bite.common.core.domain.R;
import com.bite.common.core.domain.TableDataInfo;
import com.bite.friend.domain.question.DTO.QuestionQueryDTO;
import com.bite.friend.domain.question.vo.QuestionDetailVO;
import com.bite.friend.domain.question.vo.QuestionVO;
import com.bite.friend.service.question.IQuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/question")
public class QuestionController extends BaseController {

    @Autowired
    private IQuestionService iQuestionService;

    /**
     * 题目列表
     * @param questionQueryDTO
     * @return
     */
    @NotRequireLogin
    @GetMapping("/semiLogin/list")
    public TableDataInfo list(QuestionQueryDTO questionQueryDTO){
        return iQuestionService.list(questionQueryDTO);
    }

    /**
     * 热榜 -展示题目title
     * @param
     * @return
     */
    @GetMapping("/semiLogin/hotList")
    public R<List<QuestionVO>> hotList(){
        return R.ok(iQuestionService.hotList());
    }


    /**
     * 答题页面
     * @param questionId
     * @return
     */
    @GetMapping("/detail")
    public R<QuestionDetailVO> detail(Long questionId){
        return R.ok(iQuestionService.detail(questionId));
    }


    //顺序列表
    //当前题目id
    //复用详情接口  lONG???前端会截断--->string
    @GetMapping("/preQuestion")
    public R<String> preQuestion(Long questionId){
        return R.ok(iQuestionService.preQuestion(questionId));
    }


    @GetMapping("/nextQuestion")
    public R<String> nextQuestion(Long questionId){
        return R.ok(iQuestionService.nextQuestion(questionId));
    }




}
